<%include ../common/include_header.html%>
  <style>
	.origin-price {
		font-size: 14px;
		text-decoration: line-through;
		color: gray;
	}
</style>
  <section id="feature">
    <div class="container">
      <div class="row">
        <div class="features">
          <div class="col-md-9 col-sm-6 wow fadeInDown"
            data-wow-duration="1000ms"
            data-wow-delay="100ms">

            <div class="left wow fadeInDown">
              <span style="font-size: large;">产品信息详情</span>
            </div>


            <h3 class="ab_right_title font_size_12">
              <span>您的位置：<a href="/" class="a_little_tip">产品</a>
                > <a href="/" class="a_little_tip">产品详情</a>
              </span>
            </h3>

            <div id="tabContent">

            </div>



          </div><!--/.col-md-4-->
        </div><!--/.services-->
      </div><!--/.row-->
    </div><!--/.container-->
  </section><!--/#feature-->

  <%include ../common/include_footer.html%>
    <!--jquery修改首页导航样式-->
    <script type="text/javascript" src="/web/layui/layui.js"></script>
    <!--jquery修改首页导航样式-->
    <script type="text/javascript">
			var priceTextObj = {
					"special": "福利价",
					"family": "饭团价",
					"factory": "促销价",
			}

			function getPriceTextBycate(cate) {
				return priceTextObj[cate] || '价格';
			}

    //一般直接写在一个js文件中
    layui.use(['layer', 'laypage','form'], function(){
        var layer = layui.layer
                ,laypage = layui.laypage
                , $ = layui.jquery;

        //页面初始化的时候执行
        $(function (){
            $("#products").addClass("active");
            //第一个参数：多少也，第二个参数，产品类型，0公司动态，1媒体报道，2活动报道
            var url=location.href;
            getData(url);
        });

        //从后台获取数据函数，获取页数curr的数据
        function getData(url){
            $.post(url,function(result){
                //获取后台json数据
				var mydata=result.data;
				var isVisitor=result.isVisitor;
				if (mydata.supplyTime.indexOf('T') !== -1) {
					mydata.supplyTime = mydata.supplyTime.split('T')[0];
				}
				var fromStr='</br></br>';
				var from= mydata.from?mydata.from.substr(0,60): mydata.from;
				/* var refPricesTR='';
				if(mydata.refPrice){
					refPricesTR= '<p style="text-align: left;font-size:18px;"> ' + (mydata.category == 'factory' ? '建议售价' : '原网上价格') + ': <span class="price1">￥' + mydata.refPrice + '</span></p>';
				} */
				 var refPricesTR = '';
				if ((mydata.refPrice || mydata.shopPrice) && mydata.category == 'family') {
					refPricesTR = '<p class="origin-price" style="text-align: left;font-size:18px;"> 网上原价: <span class="price1">￥' + (mydata.shopPrice || mydata.refPrice) + '</span></p>';
				}
				if (mydata.shopPrice && mydata.category == 'factory') {
					refPricesTR = '<p class="origin-price" style="text-align: left;font-size:18px;"> 网上原价: <span class="price1">￥' + mydata.shopPrice + '</span></p>';
				}
				if (mydata.refPrice && mydata.category == 'factory') {
					refPricesTR += '<p style="text-align: left;font-size:18px;"> 建议售价: <span class="price1">￥' + mydata.refPrice + '</span></p>';
				}
				if(from.length>8){
					fromStr='</br></br><p style="text-align: left">网上产品链接：<a target="_blank" href="' + mydata.from + '" style="color: blue;">' + from + '</a></p>';
				}
				debugger;
				var products_str='</br><div style="text-align: center"><strong style="font-size: 20px">'+mydata.title+'</strong>'+
					fromStr+
					'<p style="text-align: left"> 产品提供日期：' + mydata.supplyTime +'</p>'+
					'<p style="text-align: left"> 产品编号: ' + mydata.productNo +'</p>'+
					'<p style="text-align: left"> 方米立单号: ' + mydata.waybillId +'</p>';

					if(isVisitor){
						products_str += '<p style="text-align: left;font-size:18px;"> ' +
							getPriceTextBycate(mydata.category) + ': <span class="price">￥' + mydata.price + '</span></p>' + refPricesTR;
					}
					products_str+='</div>'+mydata.content;
                //将拼接好的数据填入#tabContent中
				$("#tabContent").html(products_str);
				
				document.title = mydata.title+'| 方米立家居';
            });
        };
    });
</script>